package cn.kill.orderservice.service.user.impl;

import cn.kill.orderservice.mapper.order.OrderMapper;
import cn.kill.orderservice.mapper.user.UserMapper;
import cn.kill.orderservice.pojo.User;
import cn.kill.orderservice.service.base.BaseService;
import cn.kill.orderservice.service.user.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.common.BaseMapper;

import java.util.List;

/**
 * @author 张在成
 */
@Service
@Slf4j
public class UserServiceImpl extends BaseService<User> implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public int addUser(User u) throws Exception {
        return 0;
    }

    @Override
    public List<User> getUserListInfo(List list) throws Exception {
        return null;
    }

    @Override
    public User getUserByUsername(User u) throws Exception {
        User user=null;
        try {
            if (u==null){
                throw  new Exception("用户名或密码为空");
            }
            user = userMapper.selectOne(u);

            if (user==null){
                throw  new Exception("没有查询到该用户");
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return user;
    }
}
